package com.yundashi.sellrobot.yun.base

import android.annotation.SuppressLint
import android.content.pm.ActivityInfo
import android.os.Bundle
import androidx.annotation.LayoutRes
import androidx.appcompat.app.AppCompatActivity
import com.blankj.utilcode.util.BarUtils

abstract class BaseActivity : AppCompatActivity() {

    /**
     * 初始化 View
     */
    abstract fun initView()

    /**
     * 初始化数据
     */
    abstract fun initData()

    /**
     * 初始化布局
     */
    @LayoutRes
    protected abstract fun attachLayoutRes(): Int

    @SuppressLint("SourceLockedOrientationActivity")
    override fun onCreate(savedInstanceState: Bundle?) {
        requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
        super.onCreate(savedInstanceState)
        setContentView(attachLayoutRes())
        BarUtils.setStatusBarVisibility(window, false)
        initView()
        initData()
    }

}